Fixing broken bits

Fixes the places that static analysis deem broken.