fixed a max session bug