change nrow to ncol