Finally got session saving and restoring to work