Backport a few minor chagnes.
Automatic Py3k merge for testing