My bugfix branch against 4.0.2-rc4.

Feel free to cherry-pick or merge.