Fix resource leak, correct interface inaccuracies.