Fix row/col calculation