add wait and timeout