Fix issue #2: also an enhanced fix to issue #1