adding missing nil check

nil check