More work on unsaved changes warning (Issue #324)