fixed more sql