add a lock during updating files