Fixed issue #221, and other minor changes.