add byDir to each node