manually merged changes between this MiniLib version and the one inside MAGE2D