threads: some cleanup.