Improve field type detection