diff --git a/bfps/NavierStokes.py b/bfps/NavierStokes.py
index d3ec119dcc203a4fd3555d1d138cc44592480aa5..71e9356882eab3305c5623550a85d31a96346565 100644
--- a/bfps/NavierStokes.py
+++ b/bfps/NavierStokes.py
@@ -110,6 +110,8 @@ class NavierStokes(bfps.code):
                                      ('enstrophy', np.float64),
                                      ('vel_max',   np.float64),
                                      ('renergy',   np.float64)])
+        if not os.path.isdir(self.work_dir):
+            os.makedirs(self.work_dir)
         pickle.dump(
                 self.stats_dtype,
                 open(os.path.join(
diff --git a/bfps/__init__.py b/bfps/__init__.py
index d1efa817689e07f8beb677db3d39c284c6d96ab7..9e09fc18d72d51bf0b91c56dfc115272b6e1c745 100644
--- a/bfps/__init__.py
+++ b/bfps/__init__.py
@@ -39,6 +39,17 @@ except DistributionNotFound:
     __version__ = 'git revision ' + subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip()
     header_dir = './src'
     lib_dir = './lib'
+    if not os.path.isfile(os.path.join(header_dir, 'base.hpp')):
+        tdir = os.path.dirname(os.path.realpath(__file__))
+        header_dir = os.path.join(tdir, os.pardir)
+        if not os.path.isfile(os.path.join(header_dir, 'base.hpp')):
+            raise ImportError('can not find base.hpp\n' +
+                              'tdir is {0}\n'.format(tdir) +
+                              'header_dir is {0}\n'.format(header_dir))
+        if os.path.isfile(os.path.join(header_dir, 'libbfps.so')):
+            lib_dir = tdir
+        else:
+            raise ImportError('can not find libbfps.so')
 else:
     __version__ = _dist.version
 
diff --git a/bfps/code.py b/bfps/code.py
index 01c7dee80ff4b7f8d598a78f72c1aa9fb7213eaf..ebeb404109fd3b30eb10be6ea467b191320d512d 100644
--- a/bfps/code.py
+++ b/bfps/code.py
@@ -20,7 +20,7 @@
 
 
 import bfps
-from base import base
+from bfps.base import base
 import subprocess
 import os
 import shutil
@@ -112,7 +112,7 @@ class code(base):
         for libname in libraries:
             command_strings += ['-l' + libname]
         command_strings += [self.name + '.cpp', '-o', self.name]
-        print command_strings
+        print(command_strings)
 #        print sum(command_strings)
         return subprocess.call(command_strings)
     def run(self,
@@ -122,7 +122,7 @@ class code(base):
         if self.compile_code():
             current_dir = os.getcwd()
             if not os.path.isdir(self.work_dir):
-                os.mkdir(self.work_dir)
+                os.makedirs(self.work_dir)
             if self.work_dir != './':
                 shutil.copy(self.name, self.work_dir)
             os.chdir(self.work_dir)
diff --git a/bfps/test_curl.py b/bfps/test_curl.py
index 5ca59edbbcb5b29e78376401b8d1a13388275e13..85b07975fe19daa038da00f5f20519c0801613f1 100644
--- a/bfps/test_curl.py
+++ b/bfps/test_curl.py
@@ -257,11 +257,8 @@ def test(opt):
         c.run(ncpu = opt.ncpu,
               simname = 'test')
     k, enespec = c.read_spec()
-    print k, enespec
     k, ensspec = c.read_spec(field = 'vorticity')
-    print k, ensspec
     k, k2enespec = c.read_spec(field = 'kvelocity')
-    print k, k2enespec
 
     # plot energy and enstrophy
     fig = plt.figure(figsize = (12, 6))
diff --git a/setup.py b/setup.py
index 248ea583b75fe29accdb2c07fcfcd799bace258d..eeb7f755af3d30be830e881f6d900b8cc46cf1c5 100644
--- a/setup.py
+++ b/setup.py
@@ -75,7 +75,7 @@ libbfps = Extension(
 setup(
         name = 'bfps',
         packages = ['bfps'],
-        install_requires = ['numpy>=1.8'],
+        install_requires = ['numpy>=1.8', 'matplotlib>=1.3'],
         ext_modules = [libbfps],
         data_files = header_list,
 ########################################################################
diff --git a/test.py b/test.py
index 3cfcc5410e053c62daf76e525b8b8df5a5aaa104..021bf9da31476fcbde636d457a8fa229a5d74e5e 100755
--- a/test.py
+++ b/test.py
@@ -29,6 +29,7 @@ import argparse
 import pickle
 import os
 
+import bfps
 from bfps.test import convergence_test
 from bfps.NavierStokes import test as NStest
 from bfps.resize import double as resize_test