bug fixes to debouncing