Added patch from #2808