fixing mistake and printing resulting tree