I've fixed SPR-15967. Please review this.

Comment From: snicoll

Thanks for the PR @kazuki43zoo. I did rebase it on the latest change and I believe we need to take another look to how this can be solved.