Fixes for issues #3 and #7