       drawn = opp.dig(state,
         (state, card) -> card.isVictory or card is c.Curse
       )
-      if drawn[0]?
+      if drawn.length > 0
         card = drawn[0]
         transferCardToTop(card, drawn, opp.draw)
         state.log("...#{opp.ai} puts #{card} on top of the deck.")

      drawn = opp.dig(state,
        (state, card) -> card.getCost(state)[0] >= 3                      
      )
      if drawn[0]?
        cardToTrash = drawn[0]
        state.log("...#{state.current.ai} trashes #{opp.ai}'s #{cardToTrash}.")
        choices = upgradeChoices(state, drawn, c.Saboteur.upgradeFilter)

    drawn = state.current.dig(state,
      (state, card) -> card.isTreasure
    )    
    if drawn.length > 0
      treasure = drawn[0]
      trash = state.current.ai.choose('trash', state, [treasure, null])
      if trash?
