Bug: findElementAndApply would fail to apply function sometimes