We develop a dynamic capital structure model to study how manager-shareholders agency conflicts affect the joint determination of financing and investment decisions. We show that the consumption of private benefits channel leads managers not only to choose a lower optimal leverage, but also to underinvest. We fit the model to the data and show that the average firm underinvests, younger CEOs underinvest less than older ones and firms with low institutional ownership underinvest less than those with high institutional ownership. Firms with compensation that is more closely related to the company's size exhibit overinvestment.