fixes bug in matrix generation when row*col >= 2^32