null check to avoid race condition