Cherry-picked fixes

Reviewer: trivial