Pull in changes from #2340