Fixed bug, names(matrix) is NULL, so all matrices are converted to data frames