add mutex to thread save