a bit more performant holdWhen impl