fix #294 and a related issue
Merge pull request #295 from isaacdontjelindell/loginreq-issue-294

Fix #294.