Initial static analysis support and fixes