fixed the nil error