added check for death