Try: change flatmap implementation