Formation of carboxyl groups in compounds containing amino groups