L. Carlitz has a paper, Classes of pairs of commuting matrices over a finite field, that computes the number of simultaneous similarity classes of of pairs of commuting matrices in $\operatorname{Mat}_n(\mathbb F_q)$. Two pairs $(A,B)$ and $(A',B')$ are called simultaneously similar if there is $U\in \operatorname{GL}_n(\mathbb F_q)$ such that $A'=UAU^{-1}$, $B'=UBU^{-1}$.
However, from the proof (specifically, to go from equation (4) to (5) on p. 193), it seems that he implicitly uses the statement that $(A,B)$ and $(A,B')$ belong to different similarity classes whenever $B\neq B'$. But it is possible that there is $U\in \operatorname{GL}_n(\mathbb F_q)$ that commutes with $A$ and such that $UBU^{-1}=B'$. In this case, they belong to the same class.
Is that it? If this paper turns out to be wrong, is there any result about the same question?