fixed crashing when switching levels