Force cast from boost::optional to bool.

I’m not sure why this is necessary.