cleanup in assign code; implement unassign
handle default root endpoint if not given on assign
fix assign counter