I added some tests and a couple of fixes for bug #8327.