Fixes and cherrypicks

See commits for details.