fixing issue when terminating the cluster