private boolean doDepthSearch(SimulationBrick simBrick) {
        boolean flawFound = false;

        // ignore already finished bricks (and those with delay)
        if (finished.contains(simBrick)
                || (simBrick.getBrick().hasDelay() && checkForZeroDelay)) {
            return false;
        }

        if (visited.contains(simBrick)) {

            // loop detected
            flawElements.add(simBrick.getBrick());
            for (Object o : currentPath) {
            	if (o instanceof SimulationBrick) {
            		flawElements.add(((SimulationBrick) o).getBrick());
            	} else {
            		assert o instanceof Wire;
            		flawElements.add((Element)o);
            	}
            	if (simBrick.equals(o)) {
            		break;
            	}
            }
            flawFound = true;
        } else {
            visited.add(simBrick);
            currentPath.push(simBrick);

            // search deeper on all outputs
            for (Output o : simBrick.getBrick().getOutputs()) {
                if (traverseOutput(o, simBrick.getStack())
                        | traverseUpwards(o, simBrick.getStack())) {
                    flawFound = true;
                }
            }
            finished.add(simBrick);
            currentPath.pop();
        }
        return flawFound;
    }