Fix bug in dependency depth counter algorithm.