fix illegal memory access on Windows
by using boost::smart_ptr