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