fix node reversal bug