Solved bug in node ordering