fix reduce function bug

'values' can have intermediate results: {ranks:[{ranks:[...]}, {...}]} instead of {ranks:[{...},{...}]}.