Global dirty object and fix window.beforeunload
rebuild