fixes for #16 and #17

These commits fix issues #16 and #17.