Change cmd.wait to module.wait for platform independence