Fix a few issues reported by static analyzers