fixing bug onDeath