refactor unit_map to handle ownership of shared_ptr

in the refactor to use shard_ptr in unit_pods, when units are
extracted, we must give away a shared_ptr or get a segfault. there
are only a few places that explicitly extract units, and we must
refactor them to take a shared_ptr instead of a unit*.

TODO: lua_unit