Pull in changes for #1038