Fix bug when flat_map is used inside another flat_map with enumerable, closes #2483