fixed bug in redirect