Fixing issue #1104 and updating tests.