applied patch from #1002380