The bugfix here is for the case where if a head ORM sits on a table but an item ORM sits on a view, the used function on the head won't recognize the item table as the sort of toMany nested relation that can be safely ignored for the sake of used(). By pinning the item view to a real table (through the somewhat awkwardly named lockTable), and putting in this code, used() will correctly note that the presence of a return item is no cause to prevent us from being able to delete a return head.