fix bug + regression test