Update class/class.sync.php

Added query_handler for bug tracking.
Fixed bugs:
- Tags checking,
- Cleaning associative tables.
Some performance improvement.