Faster exact algorithms for some terminal set problems