Fixed bug in redirection