Possible fix for #17279 but it uses a setTimeOut so there may be a better way.

This fix solves the problem reported in #17279, so if another solution can not be found which avoids this new setTimeOut this fix will work, but it may be better if we were able to solve this another way.