fixed another implementation mistake with "insert" function