fixing nil error