Added nil check