Mechanism of the acid hydrolysis of aromatic o-carboxyamides and relative imides