diff --git a/src/modules/files/file.c b/src/modules/files/file.c
index 6f7efce7bfce94a72fb47cf81fb6d21c4c853689..b39db7d733b62149ead4662982951c413bd7fc3b 100644
--- a/src/modules/files/file.c
+++ b/src/modules/files/file.c
@@ -1730,9 +1730,12 @@ static void set_fd_event_cb (struct my_file *f, struct svalue *cb, int event, in
 #define CBFUNCS2(CB, EVENT)						\
   static void PIKE_CONCAT(file_set_,CB) (INT32 args)			\
   {									\
-    if(!args)								\
+    if(args<2)								\
       SIMPLE_TOO_FEW_ARGS_ERROR("Stdio.File->set_" #CB, 2);		\
-    set_fd_event_cb (THIS, Pike_sp-args, EVENT, Pike_sp[-1].u.integer);	\
+    if (TYPEOF(Pike_sp[1-args]) != T_INT)				\
+      SIMPLE_ARG_TYPE_ERROR("Stdio.File->set_" #CB, 2, "int");		\
+    set_fd_event_cb (THIS, Pike_sp-args, EVENT,				\
+		     Pike_sp[1-args].u.integer);			\
   }									\
 									\
   static void PIKE_CONCAT(file_query_,CB) (INT32 args)			\
diff --git a/src/modules/files/file_functions.h b/src/modules/files/file_functions.h
index 675ab04ca3dc130c9233ff85f89e358e30451864..baf5e4356d16b07736857a464d16a98e26514669 100644
--- a/src/modules/files/file_functions.h
+++ b/src/modules/files/file_functions.h
@@ -82,7 +82,7 @@ FILE_FUNC("set_write_callback",file_set_write_callback, tFunc(CB_FUNC,tVoid))
 FILE_FUNC("set_read_oob_callback",file_set_read_oob_callback, tFunc(CB_FUNC,tVoid))
 /* function(mixed:void) */
 FILE_FUNC("set_write_oob_callback",file_set_write_oob_callback, tFunc(CB_FUNC,tVoid))
-/* function(mixed:void) */
+/* function(mixed,int:void) */
 FILE_FUNC("set_fs_event_callback",file_set_fs_event_callback, tFunc(tFunc(tInt,tOr(tVoid,tMixed)) tInt,tVoid))
 
 FILE_FUNC("query_fs_event_flags",file_query_fs_event_flags, tFunc(tVoid,tInt))