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

        return

      battle.makeMove(user.name, moveName, slot, forTurn, options)
      callback()
    
    spark.on 'sendSwitch', (battleId, toSlot, fromSlot, forTurn, callback) ->
      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()
