Fix bug with losing session