Fix bug where empty results were passed to when.reduce