Backport some changes from my fork (for intermediate tag/release)