In the end, this patch was not necessary but I still think it will be useful in the future.