Unsaved dialog conditions

Tweaked the conditions of when the unsaved dialog box appears