Fix a bunch of analyzer warnings