Fix bug where an inactive session would result in error instead of logging in again