Ok, I've attached an updated patch that should apply cleanly on top of the patches for bug#49518. The tests still pass locally for me. If there's anything else that needs fixed/adjusted, just let me know.