Fix problem with normalized average when mean is less than zero, and add a regression test for this case.