Fixing some issues with session and undoing changes on save failures.