fixed a bug in average.c, and created a modified version: average2.c