On the Yang-Mills stratification for surfaces