Fix crash on reloading event