Fixed problem with session handling