Fixed 500 when displaying sums

Fixes https://www.openproject.org/work_packages/3065, changelog entry left out to ease merging.