fix sql syntax errors on login