sync with latest upstream changes

while there fix what look like a leftover from 50703eb0fa66710ee34c1bb0c66c4ccf0a55ba59 and 6a3857f35de37c108ce2d5c289139b63bb186508