Backported the patch from bug #67407 into 5.4