fixed some bugs in death function