Fixed bug in redirect