fix: when replacing part of the relation with a subrelation, rebase that subrelation onto the current path
remove dead code