Fix issue 15 better

This seems to fix the test cases I mentioned in Issue 15.