Code analysis fixes