We should merge these changes from upstream