Backport the changes to ma.average that fix handling complex arrays.