use ffi/cvector instead of ffi/unsafe/cvector
check for duplicates before load matrix