Fix problem with large fun environment being copied unnecessarily