modified SQL and API

remove unused file

fix bugs