Proposed fixes for #1565 and #1555 and the one mentioned in the comment to #1555