Add tests + fix unicity issue

fix #9 and #3