fixed insert() and merge()