Fixes #92. Somewhat sloppy but it works.