Add unique method and fix #14 (reported by @cappelaere)