Fix bug in session redirect