Update with some changes from upstream.