Incorporate bug fix from pull request #1 and add integration test
to prove fix.