fixing the handling of persistent sessions (ie server restarts)