Fixed the averaging.