Unsaved document mark added, bugs fixed