Changed approach to fix #18416