Fix minor issues reported by scrutinizer. Fix invalid tests.