add thread lock to queue to avoid crash