fixed users being redirect to root instead of back every time they tried to access a protected page