My mod has some hidden entities that it needs to clean up when you clone my entities to a new surface and then delete the old entities.
All you need to do is specify true in your call on line 783 like this:
v.destroy({raise_destroy=true})
(At least, as far as I can tell, that's your only destroy() call that affects entities like mine, but maybe some other mods like rampant would want you to also raise_destroy in your replace_with_high_quality() function too?)