corrected error in if statement that addes extra node