Fix improper nil check