add sync lock to provide thread safe