Fix a bug in getField method