diff --git a/lib/modules/Stdio.pmod b/lib/modules/Stdio.pmod
index 49ab6576d285f87991da90b89b9b2795ba2a5919..d64f8831db337ebdf332d1da5e1d86996a7dc74d 100644
--- a/lib/modules/Stdio.pmod
+++ b/lib/modules/Stdio.pmod
@@ -42,10 +42,12 @@ class FILE {
     /* Public functions. */
     string gets()
     {
-      int p;
-      while((p=search(b, "\n", bpos)) == -1)
-	if(!get_data())
-	  return 0;
+      int p,tmp=bpos;
+      while((p=search(b, "\n", tmp)) == -1)
+      {
+	tmp=strlen(b);
+	if(!get_data()) return 0;
+      }
       return extract(p-bpos, 1);
     }
 
@@ -213,3 +215,14 @@ void perror(string s)
   stderr->write(s+": errno: "+predef::errno()+"\n");
 #endif
 }
+
+mixed `[](string index)
+{
+  mixed x=`->(this_object(),index);
+  if(x) return x;
+  switch(index)
+  {
+  case "readline": return master()->resolv("readline");
+  default: return ([])[0];
+  }
+}