Fixing some mySQL statements