Make flat_map behave with fewer suprises