fix to return shared_ptr instead of raw pointer at Agent and Environment