- fixed skipped lines
- fixed escaping of '
- added some extra sql