fix the nil class error