Fixes issue #21

This is a small patch that seems to resolve issue #21.

I have supplied a basic test.