Fixes two rare issues with header writing

1. Fixes issues concatenating non-string values in 'keyvaluepairs'

2. Forced removal of 'space dimension' if 'space' is specified as both are not allowed in standard and cause errors.