fix for cumulative deviation