Manually added changes to match main upstream changes.