diff --git a/cbits/ntrljmp.c b/cbits/ntrljmp.c
new file mode 100644
--- /dev/null
+++ b/cbits/ntrljmp.c
@@ -0,0 +1,22 @@
+/*
+** See Copyright Notice in lua.h
+*/
+
+#include <ctype.h>
+#include <stdio.h>
+
+#define luac_c
+#define LUA_CORE
+
+#include "lua.h"
+
+extern int hsmethod__call( lua_State *state );
+
+LUAI_FUNC int lua_neutralize_longjmp( lua_State *state )
+{
+    int result;
+    result = hsmethod__call(state);
+    if( result <0 )
+        return lua_error(state);
+    return result;
+}
diff --git a/hslua.cabal b/hslua.cabal
--- a/hslua.cabal
+++ b/hslua.cabal
@@ -1,7 +1,7 @@
 Name:                   hslua
-Version:                0.3.7
+Version:                0.3.8
 Stability:              beta
-Cabal-version:          >= 1.6
+Cabal-version:          >= 1.8
 License:                BSD3
 Build-type:             Simple
 License-File:           COPYRIGHT
@@ -22,15 +22,17 @@
   location:             https://github.com/osa1/hslua.git
 
 flag system-lua
-  description: Use the system-wide lua instead of the bundled copy
-  default: False
+  description:          Use the system-wide lua instead of the bundled copy
+  default:              False
 
 Library
   Build-depends:        base==4.*, mtl >= 2.1
   Exposed-modules:      Scripting.Lua, Scripting.Lua.ConfigFile
   Hs-source-dirs:       src
   if flag(system-lua)
-    Pkgconfig-depends:    lua
+    Pkgconfig-depends:  lua
+    C-sources:          cbits/ntrljmp.c
+    Include-dirs:       cbits
   else
     C-sources:          src/lapi.c, src/lauxlib.c, src/lbaselib.c, src/lcode.c,
                         src/ldblib.c, src/ldebug.c, src/ldo.c, src/ldump.c, src/lfunc.c,
@@ -38,8 +40,8 @@
                         src/lmem.c, src/loadlib.c, src/lobject.c, src/lopcodes.c,
                         src/loslib.c, src/lparser.c, src/lstate.c, src/lstring.c,
                         src/lstrlib.c, src/ltable.c, src/ltablib.c, src/ltm.c,
-                        src/lundump.c, src/lvm.c, src/lzio.c, src/ntrljmp.c
-    Include-dirs:       src
+                        src/lundump.c, src/lvm.c, src/lzio.c, cbits/ntrljmp.c
+    Include-dirs:       src, cbits
 
   if os(linux)
     CC-Options:         "-DLUA_USE_LINUX"
@@ -49,3 +51,9 @@
 
   if os(freebsd)
     CC-Options:         "-DLUA_USE_POSIX"
+
+Test-Suite simple-test
+  type:                 exitcode-stdio-1.0
+  Hs-source-dirs:       test
+  main-is:              simple-test.hs
+  Build-depends:        base, hslua
diff --git a/src/ntrljmp.c b/src/ntrljmp.c
deleted file mode 100644
--- a/src/ntrljmp.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
-** See Copyright Notice in lua.h
-*/
-
-#include <ctype.h>
-#include <stdio.h>
-
-#define luac_c
-#define LUA_CORE
-
-#include "ldebug.h"
-#include "lobject.h"
-#include "lopcodes.h"
-#include "lundump.h"
-
-extern int hsmethod__call( lua_State *state );
-
-LUAI_FUNC int lua_neutralize_longjmp( lua_State *state )
-{
-    int result;
-    result = hsmethod__call(state);
-    if( result <0 )
-        return lua_error(state);
-    return result;
-}
diff --git a/src/ntrljmp.h b/src/ntrljmp.h
deleted file mode 100644
--- a/src/ntrljmp.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
-** Lua virtual machine
-** See Copyright Notice in lua.h
-*/
-
-#ifndef lvm_h
-#define lvm_h
-
-
-#define luac_c
-#define LUA_CORE
-
-#include "lua.h"
-#include "lobject.h"
-#include "ltm.h"
-
-LUAI_FUNC int lua_neutralize_longjmp(lua_State *state);
-
-#endif
diff --git a/test/simple-test.hs b/test/simple-test.hs
new file mode 100644
--- /dev/null
+++ b/test/simple-test.hs
@@ -0,0 +1,8 @@
+import qualified Scripting.Lua as Lua
+
+main :: IO ()
+main = do
+     l <- Lua.newstate
+     Lua.openlibs l
+     Lua.callproc l "print" "Hello from Lua"
+     Lua.close l
