diff --git a/src/docode.c b/src/docode.c
index aa012e6fceebe12f53608ebf2046ff2170f25a70..4fd864d0beb91d16b797370098051852ebe6b81d 100644
--- a/src/docode.c
+++ b/src/docode.c
@@ -2463,8 +2463,7 @@ static int do_docode2(node *n, int flags)
       return 2;
     }else{
       tmp1 = do_docode(CAR(n), DO_NOT_COPY);
-      /* fake lfuns start at NUM_LFUN and are not accessible via F_LOOKUP_LFUN */
-      if ((tmp2 = lfun_lookup_id(CDR(n)->u.sval.u.string)) != -1 && tmp2 < NUM_LFUNS) {
+      if ((tmp2 = lfun_lookup_id(CDR(n)->u.sval.u.string)) != -1 ) {
 	emit1(F_LOOKUP_LFUN, tmp2);
       } else {
 	emit1(F_ARROW, store_prog_string(CDR(n)->u.sval.u.string));
diff --git a/src/program.h b/src/program.h
index a1f53b5ef902fd5978a13ffb24c38914c1aa75c1..1a09732b359531098414368673d75c988f152164 100644
--- a/src/program.h
+++ b/src/program.h
@@ -104,7 +104,6 @@ extern struct pike_string *type_check_system_string;
 #define NUM_LFUNS 45
 
 /* NOTE: After this point there are only fake lfuns.
- *       ie use low_find_lfun(), and NOT FIND_LFUN()!
  */
 #define LFUN__SEARCH 45
 #define LFUN__TYPES 46
@@ -1069,10 +1068,11 @@ void make_program_executable(struct program *p);
 /* Prototypes end here */
 
 static INLINE int FIND_LFUN(struct program * p, int lfun) {
+#ifdef PIKE_DEBUG
     dmalloc_touch(struct program*, p);
-    if (lfun < 0 || lfun >= NUM_LFUNS) return find_lfun_fatal(p, lfun);
-
-    if (p->flags & PROGRAM_FIXED) return p->lfuns[lfun];
+    if (lfun < 0) return find_lfun_fatal(p, lfun);
+#endif
+    if (p->flags & PROGRAM_FIXED && lfun < NUM_LFUNS) return p->lfuns[lfun];
     return low_find_lfun(p, lfun);
 }