Various fixes, features bundled for v0.41.0 (#4293)