Add a test for this bug, and add a note in NEWS