Bayesian analysis of the role of metacognition in cognitive control