fix averageView issues with better implementation