- fix quoting
- fix deprecated api call embedded in sql code