Fixes for issues #16 and #17