Fix issue #1047