fix bugs in Insert SQL