Fixed issue when only one of nrows or ncols was specified