Issues #17 and #18

Fix issues #17 and #18