fix some errors in insert