Implementing onMachineMerge

Implementing new onMachineMerge callback from BeefCore. Using it to
clear out internal data.
Also fixing a thrown exception, which can be observed when breaking a
working machine.