Fixed race condition with celery tasks