edited actor_die routine to free memory, not tested