beforeUnload hook recovered (fixes #122)