Fixed issue #1108 and #1112

Fixed issue #1108 and #1112