Added nil check

NIL CHECK