Fixed Issue #2 and #4

Not sure how this works, but I'm guessing you can merge the fixed code into your branch.