implement warn on no unsaved changes and fix tests