Merged back from upstream