anchor.diff:  	player_ip = sanitizeSQL(player_ip)
   	player_cid = sanitizeSQL(player_cid)
   	var/bantime
  -	var/datum/DBQuery/query_edit_ban_get_player = SSdbcore.NewQuery("SELECT byond_key, (SELECT bantime FROM [format_table_name("ban")] WHERE id = [ban_id]), ip, computerid FROM [format_table_name("player")] WHERE ckey = '[player_ckey]'")
  -	if(!query_edit_ban_get_player.warn_execute())
  -		qdel(query_edit_ban_get_player)
  -		return
  -	if(query_edit_ban_get_player.NextRow())
  -		player_key = query_edit_ban_get_player.item[1]
  -		bantime = query_edit_ban_get_player.item[2]
  -		if(use_last_connection)
  -			player_ip = query_edit_ban_get_player.item[3]
  -			player_cid = query_edit_ban_get_player.item[4]
  -	else
  -		if(use_last_connection)
  -			to_chat(usr, "<span class='danger'>Ban not edited. [player_key]/([player_ckey]) hasn't been seen before, unable to use IP and CID from last connection.</span>")
  +	if(player_ckey)
  +		var/datum/DBQuery/query_edit_ban_get_player = SSdbcore.NewQuery("SELECT byond_key, (SELECT bantime FROM [format_table_name("ban")] WHERE id = [ban_id]), ip, computerid FROM [format_table_name("player")] WHERE ckey = '[player_ckey]'")
  +		if(!query_edit_ban_get_player.warn_execute())
   			qdel(query_edit_ban_get_player)
   			return
  -	qdel(query_edit_ban_get_player)
  +		if(query_edit_ban_get_player.NextRow())
  +			player_key = query_edit_ban_get_player.item[1]
  +			bantime = query_edit_ban_get_player.item[2]
  +			if(use_last_connection)
  +				player_ip = query_edit_ban_get_player.item[3]
  +				player_cid = query_edit_ban_get_player.item[4]
  +		else
  +			if(use_last_connection)
  +				to_chat(usr, "<span class='danger'>Ban not edited. [player_key]/([player_ckey]) hasn't been seen before, unable to use IP and CID from last connection.</span>")
  +				qdel(query_edit_ban_get_player)
  +				return
  +		qdel(query_edit_ban_get_player)
   	if(applies_to_admins && (applies_to_admins != old_applies))
   		var/admin_ckey = sanitizeSQL(usr.client.ckey)
   		var/datum/DBQuery/query_check_adminban_count = SSdbcore.NewQuery("SELECT COUNT(DISTINCT bantime) FROM [format_table_name("ban")] WHERE a_ckey = '[admin_ckey]' AND applies_to_admins = 1 AND unbanned_datetime IS NULL AND (expiration_time IS NULL OR expiration_time > NOW())")
  
positive.code: 	var/player_ckey = sanitizeSQL(ckey(player_key))
  	player_ip = sanitizeSQL(player_ip)
  	player_cid = sanitizeSQL(player_cid)
  	var/datum/DBQuery/query_create_ban_get_player = SSdbcore.NewQuery("SELECT byond_key, INET_NTOA(ip), computerid FROM [format_table_name("player")] WHERE ckey = '[player_ckey]'")
  	if(!query_create_ban_get_player.warn_execute())
  		qdel(query_create_ban_get_player)
  		return
  	if(query_create_ban_get_player.NextRow())
  		player_key = query_create_ban_get_player.item[1]
  		if(use_last_connection)
  			player_ip = query_create_ban_get_player.item[2]
  			player_cid = query_create_ban_get_player.item[3]
  	else
  		if(use_last_connection)
  			to_chat(usr, "<span class='danger'>Ban not created. [player_key]/([player_ckey]) hasn't been seen before, unable to use IP and CID from last connection.</span>")
  			qdel(query_create_ban_get_player)
  			return
  		else
  			if(alert(usr, "[player_key]/([player_ckey]) has not been seen before, are you sure you want to create a ban for them?", "Unknown key", "Yes", "No", "Cancel") != "Yes")
  				qdel(query_create_ban_get_player)
  				return
  	qdel(query_create_ban_get_player)
  	var/admin_ckey = sanitizeSQL(usr.client.ckey)
  	if(applies_to_admins)
  		var/datum/DBQuery/query_check_adminban_count = SSdbcore.NewQuery("SELECT COUNT(DISTINCT bantime) FROM [format_table_name("ban")] WHERE a_ckey = '[admin_ckey]' AND applies_to_admins = 1 AND unbanned_datetime IS NULL AND (expiration_time IS NULL OR expiration_time > NOW())")
  
negative.code: 			if("server")
  				roles_to_ban += "Server"
  			if("role")
  				href_list.Remove("Command", "Security", "Engineering", "Medical", "Science", "Supply", "Silicon", "Abstract", "Civilian", "Ghost and Other Roles", "Antagonist Positions") //remove the role banner hidden input values
  				if(href_list[href_list.len] == "roleban_delimiter")
  					error_state += "Role ban was selected but no roles to ban were selected."
  				else
  					var/delimiter_pos = href_list.Find("roleban_delimiter")
  					href_list.Cut(1, delimiter_pos+1)//remove every list element before and including roleban_delimiter so we have a list of only the roles to ban
  					for(var/key in href_list) //flatten into a list of only unique keys
  