fixed error in reorder matrix that was dropping samples