[bugfix] Various counts and checks.