Clean up a bunch of analyzer issues

Fixed the noted analyzer issues.