fix session handling