Closes issue #1130 and #1141