more smart pointers on more places

so that we have lower number of leaks