Merge new code from upstream.

Just for @zarino