Static analysis fixes

I've been slogging through several hundred static analysis issues to determine a cause for #202. A vast majority have been false positives, but I did manage to fix a few minor issues from it.