fixed bug using n_row instead of n_col