Test cases for #599

The first test in this PR passes, the second fails. See #599.