nil check corrected