Fixed issue #8 + regression test