get_average function throws exception on line 29,30