adding unsafethaw for dense matrices