Addressed a number of minor bugs reported by Clang.
Corrected an issue reported by clang related to dereferencing a NULL value.