Fix some SQL quoting issues here and there.