Fixed issues reported by static analyzer