Fix issue #1240