Fix buffer overrun while comparing two sortNodes