fix throttle and debounce to be re-entrant