replacing some raw pointers by smart pointers