[Backport] prs 414 417 422

Backport a few pull requests:

* #414
* #417
* #422