diff --git a/mi/mieq.c b/mi/mieq.c
index a1f9cc6..91b7a51 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -255,8 +255,8 @@ ChangeDeviceID(DeviceIntPtr dev, xEvent* event)
             // do nothing or drink a beer. your choice.
         } else
             DebugF("[mi] Unknown generic event (%d/%d), cannot change id.\n",
-                    ((xGenericEvent*)ev)->extension,
-                    ((xGenericEvent*)ev)->evtype);
+                    ((xGenericEvent*)event)->extension,
+                    ((xGenericEvent*)event)->evtype);
     } else
         DebugF("[mi] Unknown event type (%d), cannot change id.\n", type);
 }
