Fix issue #1031