session tweak - better cleanup when session fails, and handles auto-reloader.