fixed the crashing problem