Fix issues #110 and #168.