Fix some static analysis issues
Simplify build tree dependencies