fixes #17279 I do not like the use of setTimeOut, but have not found a better way, and it does solve the problem, had an issue with the merge of the pull request, so had to re-do the change and commit it again here.
(cherry picked from commit 03a1f09cb8149858b3907725db6e3e0fe9d49678)