Fixed work on issue #241
Fixed work on issue #176