Fixed bug in debounce counter