rearranged delete table to avoid fk issue