fixed issue #1115 + test