fixed broken onbeforeunload