Put this check before the allocate