--- a/gui/oprof_start.cpp
+++ b/gui/oprof_start.cpp
@@ -804,8 +804,9 @@
 
 	unit_mask_group->setExclusive(um->unit_type_mask == utm_exclusive);
 
-	for (size_t i = 0; i < OP_MAX_HANDLED_UMS; ++i) {
-		QCheckBox * check = 0;
+	QCheckBox * check = NULL;
+
+	for (size_t i = 0; i < um->num; ++i) {
 		switch (i) {
 			case 0: check = check0; break;
 			case 1: check = check1; break;