Fix for issue 17

This PR fixes #17. 
To test, run:
`$ node ./test/issue17.js`