Program: 158587
Project: 158587
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Spell spell=game.getStack().getSpell(targetPointer.getFirst(game,source));
  if (spell == null) {
    spell=(Spell)game.getLastKnownInformation(targetPointer.getFirst(game,source),Zone.STACK);
  }
  Player controller=game.getPlayer(source.getControllerId());
  if (spell != null && controller != null) {
    Target usedTarget=null;
    setUsedTarget:     for (    Mode mode : spell.getSpellAbility().getModes().getSelectedModes()) {
      for (      Target target : mode.getTargets()) {
        if (target.getFirstTarget().equals(source.getSourceId())) {
          usedTarget=target.copy();
          usedTarget.clearChosen();
          break setUsedTarget;
        }
      }
    }
    if (usedTarget == null) {
      return false;
    }
    for (    Permanent creature : game.getState().getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(),source.getControllerId(),game)) {
      if (!creature.getId().equals(source.getSourceId()) && usedTarget.canTarget(source.getControllerId(),creature.getId(),source,game)) {
        Spell copy=spell.copySpell();
        setTarget:         for (        Mode mode : spell.getSpellAbility().getModes().getSelectedModes()) {
          for (          Target target : mode.getTargets()) {
            if (target.getClass().equals(usedTarget.getClass())) {
              target.clearChosen();
              if (target.getMessage().equals(usedTarget.getMessage())) {
                target.add(creature.getId(),game);
                break setTarget;
              }
            }
          }
        }
        copy.setControllerId(source.getControllerId());
        copy.setCopiedSpell(true);
        game.getStack().push(copy);
        String activateMessage=copy.getActivatedMessage(game);
        if (activateMessage.startsWith("String_Node_Str")) {
          activateMessage=activateMessage.substring(6);
        }
        if (!game.isSimulation()) {
          game.informPlayers(controller.getLogName() + activateMessage);
        }
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Spell spell=game.getStack().getSpell(targetPointer.getFirst(game,source));
  if (spell == null) {
    spell=(Spell)game.getLastKnownInformation(targetPointer.getFirst(game,source),Zone.STACK);
  }
  Player controller=game.getPlayer(source.getControllerId());
  if (spell != null && controller != null) {
    Target usedTarget=null;
    setUsedTarget:     for (    Ability ability : spell.getSpellAbilities()) {
      for (      Mode mode : ability.getModes().getSelectedModes()) {
        for (        Target target : mode.getTargets()) {
          if (!target.isNotTarget() && target.getFirstTarget().equals(source.getSourceId())) {
            usedTarget=target.copy();
            usedTarget.clearChosen();
            break setUsedTarget;
          }
        }
      }
    }
    if (usedTarget == null) {
      return false;
    }
    for (    Permanent creature : game.getState().getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(),source.getControllerId(),game)) {
      if (!creature.getId().equals(source.getSourceId()) && usedTarget.canTarget(source.getControllerId(),creature.getId(),source,game)) {
        Spell copy=spell.copySpell(source.getControllerId());
        setTarget:         for (        Mode mode : spell.getSpellAbility().getModes().getSelectedModes()) {
          for (          Target target : mode.getTargets()) {
            if (target.getClass().equals(usedTarget.getClass())) {
              target.clearChosen();
              if (target.getMessage().equals(usedTarget.getMessage())) {
                target.add(creature.getId(),game);
                break setTarget;
              }
            }
          }
        }
        game.getStack().push(copy);
        String activateMessage=copy.getActivatedMessage(game);
        if (activateMessage.startsWith("String_Node_Str")) {
          activateMessage=activateMessage.substring(6);
        }
        if (!game.isSimulation()) {
          game.informPlayers(controller.getLogName() + activateMessage);
        }
      }
    }
    return true;
  }
  return false;
}