Fix issue #187

This PR replaces #201