fixed including nodes shared by two ways twice
fixed bug caused by reversing arrays in place