@minrk is right that one of these two things needs to be there as `toinsert` is not defined in scope.