fix egregious memory allocation error