Robustness of quantum gates in the presence of noise