Fix and improve the new onDamage hook