fixed bugs with handling of whitespace and square brackets in field names.