Multiple fixes and improvements. Building from scratch with nested deps works.