fixed bug with nil fields