Fix #354, make jar mods and patch files in general more resilient.