check for NIL befor accessing dict