Using std/boost make_shared for creating shared pointers

Using make_shared for creating boost/std shared pointers will reduce the number of allocations
I also fixed boost::function nulling issue
if it can be done with a const value I'd prefer that to a macro