Fix routing issue after registering or logging in