Bug fix + regression test