Fix two issues reported by coverity