added some changes to smart pointer now works in linux, need to improve in windows.