Make atomic variable to avoid race condition