fix possible bug in session keep.