fix bug when storing session state