fix session manage in tests