Fixed inappropriate usage of smart pointers.