Fix bug which could have caused wrong order of field names under certain circumstances