fixed the nil problem