Added a regression test and fix for github issue #83. Fixes #83.