Fix implicit conversion from shared_ptr to bool

C++11 does not approve the implicit conversion, see http://stackoverflow.com/questions/7580009/gcc-error-cannot-convert-const-shared-ptr-to-bool-in-return