handled error cases and messages for KMeans