Fix the debouncing logic