Brought in changes for #1034