fix session thread-unsafety issue