Add a test for average usage calculation and fix an issue found by
it. Thanks Tests!