fix bug with nil object in dictionary