Fix ticket #6945 by applying patch from Kaylyn Bogle