Singularities and K-semistability