Fix issue #110 and issue #168.

Similar to the prior PR to master, but for the 0.9.x versions.

Fixes issue #110 and issue #168.