modified waitondeployments function in control script