sophia: implement proper node deletion; fixes for cursor cache