add sleep_interval and  fix a bug