cleaning old nodes and entities, code copied from https://forum.minetest.net/viewtopic.php?id=2777