fixed bugs with manual counting