bug fix: unsigned int is used for decreasing counting