fix issue #222

See comments in #222