fixed bad sql on initial login