fixed problem with duplicate nodes