fixed redirecting bug