Fix dependency compilation order