diff -Naur cwiid-0.6.00/python/Wiimote.c cwiid-0.6.00.new/python/Wiimote.c
--- cwiid-0.6.00/python/Wiimote.c	2007-06-19 04:28:49.000000000 +0200
+++ cwiid-0.6.00.new/python/Wiimote.c	2009-01-05 01:19:13.000000000 +0100
@@ -250,6 +250,8 @@
 
 static PyObject *Wiimote_close(Wiimote *self)
 {
+	if (!self->wiimote)
+		return NULL;
 	if (cwiid_close(self->wiimote)) {
 		PyErr_SetString(PyExc_RuntimeError,
 		                "Error closing wiimote connection");
@@ -266,6 +268,8 @@
 	static char *kwlist[] = {"flags", NULL};
 	int flags;
 
+	if (!self->wiimote)
+		return NULL;
 	if (!PyArg_ParseTupleAndKeywords(args, kwds, "i:cwiid.Wiimote.enable",
 	                                 kwlist, &flags)) {
 		return NULL;
@@ -284,6 +288,8 @@
 	static char *kwlist[] = {"flags", NULL};
 	int flags;
 
+	if (!self->wiimote)
+		return NULL;
 	if (!PyArg_ParseTupleAndKeywords(args, kwds, "i:cwiid.Wiimote.disable",
 	                                 kwlist, &flags)) {
 		return NULL;
@@ -303,6 +309,8 @@
 {
 	PyObject *OldCallback;
 
+	if (!self->wiimote)
+		return NULL;
 	if (!PyCallable_Check(NewCallback)) {
 		PyErr_SetString(PyExc_TypeError, "callback must be callable!");
 	}
@@ -337,6 +345,8 @@
 	struct timespec t;
 	PyObject *PyMesg;
 
+	if (!self->wiimote)
+		return NULL;
 	if (cwiid_get_mesg(self->wiimote, &mesg_count, &mesg, &t)) {
 		if (errno == EAGAIN) {
 			Py_RETURN_NONE;
@@ -360,10 +370,14 @@
 	struct cwiid_state state;
 	PyObject *PyState;
 
+	if (!self->wiimote)
+		return NULL;
 	if (cwiid_get_state(self->wiimote, &state)) {
 		PyErr_SetString(PyExc_IOError, "get state error");
 		return NULL;
 	}
+	if (!self->wiimote)
+		return NULL;
 
 	PyState = Py_BuildValue("{s:B,s:B,s:B,s:B,s:i,s:i}",
 	                        "rpt_mode", state.rpt_mode,
@@ -529,7 +543,9 @@
 	int ext_type;
 	struct acc_cal acc_cal;
 	PyObject *PyAccCal;
-
+	
+	if (!self->wiimote)
+		return NULL;
 	if (!PyArg_ParseTupleAndKeywords(args, kwds,
 	                                 "i:cwiid.Wiimote.get_acc_cal", kwlist,
 	                                 &ext_type)) {
@@ -566,6 +582,8 @@
 {
 	long led;
 
+	if (!self->wiimote)
+		return NULL;
 	if (((led = PyInt_AsLong(PyLed)) == -1) && PyErr_Occurred()) {
 		return -1;
 	}
@@ -584,6 +602,8 @@
 {
 	long rumble;
 
+	if (!self->wiimote)
+		return NULL;
 	if (((rumble = PyInt_AsLong(PyRumble)) == -1) && PyErr_Occurred()) {
 		return -1;
 	}
@@ -602,6 +622,8 @@
 {
 	long rpt_mode;
 
+	if (!self->wiimote)
+		return NULL;
 	if (((rpt_mode = PyInt_AsLong(PyRptMode)) == -1) && PyErr_Occurred()) {
 		return -1;
 	}
@@ -640,6 +662,8 @@
 	void *buf;
 	PyObject *pyRetBuf;
 
+	if (!self->wiimote)
+		return NULL;
 	if (!PyArg_ParseTupleAndKeywords(args, kwds, "BII:cwiid.Wiimote.read",
 	                                 kwlist, &flags, &offset, &len)) {
 		return NULL;
@@ -669,6 +693,8 @@
 	void *buf;
 	int len;
 
+	if (!self->wiimote)
+		return NULL;
 	if (!PyArg_ParseTupleAndKeywords(args, kwds, "BIt#:cwiid.Wiimote.write",
 	                                 kwlist, &flags, &offset, &buf, &len)) {
 		return NULL;
@@ -690,6 +716,8 @@
 	PyObject *PySelf;
 	PyGILState_STATE gstate;
 
+	if (!wiimote)
+		return NULL;
 	gstate = PyGILState_Ensure();
 
 	ArgTuple = ConvertMesgArray(mesg_count, mesg);

