Row, Col to 1D index fix