Fixed redirecting bug upon login