Fix next handling in login