Fixed issue with session management