Fix division by 0 in Average class