sqlite: apply avg fix to diff and rate