         return
 
       battle.makeSwitch(user.name, toSlot, fromSlot, forTurn)
-      callback()
+      callback?()
 
     spark.on 'sendCancelAction', (battleId, forTurn) ->
       battle = server.findBattle(battleId)

      attributes['contents'] = JSON.stringify(team.pokemon)
      new database.Team(attributes)
        .save().then (team) ->
          callback(team.id)

    spark.on 'requestTeams', ->
      q = new database.Teams()

          controller.battle.playerNames[1],
          currentTime - controller.battle.createdAt
        ] for controller in server.getOngoingBattles())
      callback?(battleMetadata)

    spark.on 'findBattle', (format, team, altName=null) ->
      # Note: If altName == null, then isAltOwnedBy will return true
