Fixes to issues identified by Coverity.

I didn't call the sentinels ctor explicitly because of problems with nvcc. This change will probably break the CUDA port.