diff --git a/src/PutBEvent.c b/src/PutBEvent.c
index f7b74b31deeba41a47816a53bbccf5319810ffb3..b8273e1adca11f6a7cee0199729a0908c2888937 100644
--- a/src/PutBEvent.c
+++ b/src/PutBEvent.c
@@ -85,15 +85,20 @@ XPutBackEvent (
 	int type = event->type & 0177;
 
 	LockDisplay(dpy);
-	fp = dpy->wire_vec[type];
-	if (fp == NULL)
-		fp = _XEventToWire;
-	ret = (*fp)(dpy, event, &wire);
-	if (ret)
+	if (type == GenericEvent)
+		ret = _XPutBackEvent(dpy, event);
+	else
 	{
-		ret = (*dpy->event_vec[type])(dpy, &lib, &wire);
+		fp = dpy->wire_vec[type];
+		if (fp == NULL)
+			fp = _XEventToWire;
+		ret = (*fp)(dpy, event, &wire);
 		if (ret)
-			ret = _XPutBackEvent(dpy, &lib);
+		{
+			ret = (*dpy->event_vec[type])(dpy, &lib, &wire);
+			if (ret)
+				ret = _XPutBackEvent(dpy, &lib);
+		}
 	}
 	UnlockDisplay(dpy);
 	return ret;
