Applied patches from #2700