Elimination of groups during the preparation of azo compounds