pull in upstream changes

(Hopefully I'm doing this right and won't send a pull request to upstream accidentally...)