Typo, setting the first element of nids[] to NULL instead of setting