diff -Naur a/trio.c b/trio.c
--- a/trio.c	2014-05-09 10:19:50.000000000 +0530
+++ b/trio.c	2014-05-12 16:37:22.000000000 +0530
@@ -6434,11 +6434,14 @@
 	   trio_class_t *self,
 	   int *intPointer)
 {
-  FILE *file = (FILE *)self->location;
+  FILE *file;
 
   assert(VALID(self));
+  assert(VALID(self->location));
   assert(VALID(file));
 
+  file = (FILE *)self->location;
+
   self->current = fgetc(file);
   if (self->current == EOF)
     {
@@ -6467,11 +6470,14 @@
 	   trio_class_t *self,
 	   int *intPointer)
 {
-  int fd = *((int *)self->location);
+  int fd;
   int size;
   unsigned char input;
 
   assert(VALID(self));
+  assert(VALID(self->location));
+
+  fd = *((int *)self->location);
 
   size = read(fd, &input, sizeof(char));
   if (size == -1)
