fixed bug with computing average values over several runs