Added averageTypes for the toArray output for bug #8138.