fixed handling of fork and bridge, still TODO fixing ring condition