changed warn_onbeforeunload into a boolean