fix logic with reading matrix, remove dynamic values of rows and cols