Patches from Pierangelo Masarati