Fix #559. Add a test to demonstrate that this isn't a bug