Bug fix for 4.1: sum on resulting array,

not on database