fix lock

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
fix race condition

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>