nitiwiki: fix a bug where multiple independent trails could have been merged