Fix bug when calling reduce() with empty ranges