Fix infinite login loop