Added test and fix for #93

Closes #93 

I added the failing test as the first commit to show the problem and the fix as the 2nd commit.