Static analysis fixes and other minor fixes.