add error counting for some missed behaviors. (cherry picked from commit 43eb0ce3bf76a5d287b93a767bead9ad6230a1ad)