fix the problem of sum over boolean arrays (tested)