aaah yes that explains everything, you cannot really change the attributes which quality improves, so basically all quality mods use separate entities for different quality. This means that when you replace a drill, the MQS mod immediately replaces it in place with a technically different one, my script assumes the build failed (the entity name is different) so it refunds the rare drill item. I think I can make it work by comparing only the quality at the exact position instead of the entity name, will try to do something about it