How are the admin rels added/deleted in this case, is it a special pl procedure for dot_lrn? Maybe post them if this might cause the problem.
Also, could you print out the lines showing the results, not just the count, I'm having trouble figuring out your query. How do you select an acs_rel with rel_id null? Is there some magic in this query?