tests and fix for onDeath func