add mutex for thread safety
2 files changed