upstream changes for #82