Added patch from upstream bug 9747