fix session bugs