fixes freeze bug