Fixed debounce code.