fixes crash on restart