Compilation fixes for C++11 compilers.

boost::shared_ptr has explicit operator bool() with C++11 compilers (in particular, Visual Studio 2013 which is C++11 by default) since 1.53 (see http://www.boost.org/users/history/version_1_53_0.html).
Explicit != NULL check needs to be used instead.

See also http://stackoverflow.com/questions/15234527/boost-1-53-local-date-time-compiler-error-with-std-c0x