its ok to return NULL if we are allocating zero elements