fix session optional problem