Fix for #94.
/cc @nicofrand I guess you might be interested in this to help with the duplicates stuff.