A couple bug fixes; also fixed issue #42