Backports from patches.
Merge pull request #162 from alxhub/backports

Backports from patches.