add test for unregistering agent on death

also, remove redundant line