clean-up for multithread support