replaced window.setTimeout - bug fix for debounce