Fixed redirect bug after login