The role of domestic polices in stabilizing capital flows