thread exit works; may have leaks