Fixed based on suggestions from PR 1751