add mutex for multithread