fixing a counting error