Fix issue #187

TODO: Could really use a unit test... Meh.