Fixed bug in destroying state on lua refresh.