Fixes the fatal error which occurred when the optional fields where left empty.
@jonas check and merge