Fix bug in automatically logging in after registration