Index: tools/mkfat.py
===================================================================
--- tools/mkfat.py	(revision f2b3d3ea3dc1fbb7a2312b326613bcc88a3bfaf5)
+++ tools/mkfat.py	(revision f7e69f551592fae9721419beef3fd98fa6fefbdb)
@@ -189,5 +189,5 @@
 	"Filter FAT legal characters"
 	
-	filtered_name = ''
+	filtered_name = b''
 	filtered = False
 	
@@ -205,5 +205,6 @@
 	
 	ascii_name, lfn = fat_lchars(name)
-	ascii_parts = ascii_name.split('.')
+	# Splitting works only on strings, not on bytes
+	ascii_parts = ascii_name.decode('utf8').split('.')
 	
 	short_name = ''
@@ -444,5 +445,5 @@
 	extra_bytes = int(sys.argv[1])
 	
-	path = os.path.abspath(sys.argv[2].decode())
+	path = os.path.abspath(sys.argv[2])
 	if (not os.path.isdir(path)):
 		print("<PATH> must be a directory")
Index: tools/xstruct.py
===================================================================
--- tools/xstruct.py	(revision f2b3d3ea3dc1fbb7a2312b326613bcc88a3bfaf5)
+++ tools/xstruct.py	(revision f7e69f551592fae9721419beef3fd98fa6fefbdb)
@@ -35,5 +35,13 @@
 import types
 
+# Handle long integer conversions nicely in both Python 2 and Python 3
 integer_types = (int, long) if sys.version < '3' else (int,)
+
+# Ensure that 's' format for struct receives correct data type depending
+# on Python version (needed due to different way to encode into bytes) 
+ensure_string = \
+	(lambda value: value if type(value) is str else bytes(value)) \
+		if sys.version < '3' else \
+	(lambda value: bytes(value, 'ascii') if type(value) is str else value)
 
 ranges = {
@@ -77,4 +85,6 @@
 					args.append(item)
 			else:
+				if (fmt == "s"):
+					value = ensure_string(value)
 				check_range(variable, fmt, value)
 				args.append(value)		
