Fix NaN problem
* function avg gets arrays as input!