Add a pid/lock in order to avoid concurrency issue