Merging in changes from #3594