Some v0.5 cherry picks

Original PRs: #2489, #2477