Fix issues #1 and #2 as posted on github