mysql limit and debug mode

- mysql limit bug fixed.
- debug mode added.