Add foreign key check