improve stability of ui automation script