fix (and test) for issue 546
fixes infinite loop issue introduced by previous
Merge branch 'issue_546' into v1.4.x