fixed wrong behaviour of preventDup parameter