Another unit test and corresponding bugfix.