Fixed bug with assignment NULL to the smart pointer