Merge #50 and #51 onto v0.4-fixes

Merge the fixes for #50 and #51 onto the v0.4-fixes branch in advance of a 0.4.2 release.