Fix issues reported by scrutinizer