Fixing Undefined index nids and tids.