Fixes for issues #7 and #3