Fixed corner case in trends metric.
Merge branch 'master-patch'