add wait code for mac