fixing nil bug