added check for node in cluster before leaving