modified session controller to fix redirection issues