Fix login (Closes #658)