Fixed issue with unique_ptr being copied incorrectly.