Fixed nil check