:substitute with corrections

this is a fix to #2359