Merge pull request #389 from dalkon/master

Move onPrepareDeath so you can "cancel" the event