Random fixes

Some fixes, in part borrowed from the fusion branch, which deserve a quick fix on master.