Fixing Undefined nid.