fix some mistakes on insertion