Fixed bugs in Insert