--- a/libpe_utils/op_pe_utils.cpp
+++ b/libpe_utils/op_pe_utils.cpp
@@ -459,6 +459,7 @@
 	config |= base_code & 0xFFULL;
 
 	// Setup unitmask field
+handle_named_um:
 	if (event->um_name[0]) {
 		command = OP_BINDIR;
 		command += "ophelp ";
@@ -495,6 +496,7 @@
 		else
 			config |= ((event->evt_um & 0xFFULL) << 8);
 	} else if (!event->evt_um) {
+		char * endptr;
 		command.clear();
 		command = OP_BINDIR;
 		command += "ophelp ";
@@ -514,7 +516,13 @@
 			exit(EXIT_FAILURE);
 		}
 		pclose(fp);
-		event->evt_um = strtoull(mask, (char **) NULL, 10);
+		event->evt_um = strtoull(mask, &endptr, 10);
+		if ((endptr >= mask) &&
+				(endptr <= (mask + strlen(mask) - 1))) {
+			// Must be a default named unit mask
+			strncpy(event->um_name, mask, OP_MAX_UM_NAME_LEN);
+			goto handle_named_um;
+		}
 		config |= ((event->evt_um & 0xFFULL) << 8);
 	} else {
 		config |= ((event->evt_um & 0xFFULL) << 8);