if (td.getAllocationPhases().isEmpty()) {
if (td.getDeficitAllocationPhases().isEmpty()) {
  private void fillDeficit(TaskDeficit td, int currentBucket, Inventory inv, LogisticsInventoryPG thePG){    Task task = td.getTask();    if (task.getVerb().equals(Constants.Verb.WITHDRAW)) {      // task is completed      if (td.getAllocationPhases().isEmpty()) {        createLateAllocation(task, thePG.convertBucketToTime(currentBucket), inv, thePG);      } else {        //BD added the td.addPhase line to make a phase to fill the deficit        td.addPhase(td.getRemainingQty(), currentBucket);        createPhasedAllocationResult(td, currentBucket, inv, thePG, true);      }    } else {      td.addPhase(td.getRemainingQty(), currentBucket);      if ((thePG.convertBucketToTime(currentBucket + 1) >=              (long)PluginHelper.getPreferenceBestValue(task, AspectType.END_TIME))) {        createPhasedAllocationResult(td, currentBucket, inv, thePG, true);      }    }    trailingPointersRemove.add(td);  }