Improved error handling in flatMap and filter.