fixed some bugs with saving sessions