Backport fixes from 0.9 release