Fix and test case for #653

Closes #653