diff --git a/bin/isimage b/bin/isimage
index f2ec719af292351f82fdd1fb134c5753221b2fc6..f15e1e733ddfcb7b9b3356af100c39fefb89e920 100755
--- a/bin/isimage
+++ b/bin/isimage
@@ -39,7 +39,7 @@ def build(args):
         # load source image
         simg = SourceImage(args.path)
         # do the job
-        simg.build(args.force)
+        simg.build(force=args.force, check=args.check)
         # compute building time
         t1 = time.time()
         dt = int(t1 - t0)
@@ -65,6 +65,9 @@ p_init.set_defaults(func=init)
 p_build =  subparsers.add_parser("build", help=build.__doc__.lower())
 p_build.add_argument('-f', "--force", action="store_true", dest="force", default=False,
                      help="overwrite existing image")
+p_build.add_argument('-c', "--no-check", action="store_false", dest="check", default=True,
+                     help="do not check compilation before adding scripts")
+
 p_build.add_argument("path", nargs="?", type=str, default=".")
 p_build.set_defaults(func=build)
 # Parse and run
diff --git a/installsystems/image.py b/installsystems/image.py
index cd41d6fe83c13ea3457ec5653a2e397aff474d48..ff9a9d44a692ee18017f4b33be455b7dcb8bac3a 100644
--- a/installsystems/image.py
+++ b/installsystems/image.py
@@ -129,14 +129,18 @@ class SourceImage(Image):
         if not os.path.exists(os.path.join(self.base_path, "description")):
             raise Exception("No description file")
 
-    def build(self, overwrite=False):
+    def build(self, force=False, check=True):
         '''
         Create packaged image
         '''
         # check if free to create script tarball
-        if os.path.exists(self.image_name) and overwrite == False:
+        if os.path.exists(self.image_name) and force == False:
             raise Exception("Tarball already exists. Remove it before")
-        #  Create payload files
+        # Check python file
+        if check:
+            self._check_scripts(self.parser_path)
+            self._check_scripts(self.setup_path)
+        # Create payload files
         payloads = self._create_payloads()
         # generate a JSON description
         jdesc = self.generate_json_description(payloads)
@@ -259,12 +263,11 @@ class SourceImage(Image):
         for fi in os.listdir(directory):
             # check name
             if not re.match("\d+-.*\.py$", fi):
-                debug("name %s skipped: invalid name" % fi)
+                debug("%s skipped: invalid name" % fi)
                 continue
             # adding file
             ti = tarball.gettarinfo(os.path.join(directory, fi),
-                                    arcname=os.path.join(basedirectory,
-                                                         os.path.basename(fi)))
+                                    arcname=os.path.join(basedirectory, fi))
             ti.mode = 0755
             ti.uid = ti.gid = 0
             ti.uname = ti.gname = "root"
@@ -272,6 +275,25 @@ class SourceImage(Image):
             arrow("%s added" % fi)
         arrowlevel(-1)
 
+    def _check_scripts(self, directory):
+        '''
+        Check if scripts inside a directory can be compiled
+        '''
+        basedirectory = os.path.basename(directory)
+        arrow("Checking %s scripts" % basedirectory)
+        arrowlevel(1)
+        # checking each file
+        for fi in os.listdir(directory):
+            # check name
+            if not re.match("\d+-.*\.py$", fi):
+                debug("%s skipped: invalid name" % fi)
+                continue
+            # compiling file
+            fs = open(os.path.join(directory, fi), "rb").read()
+            compile(fs, fi, mode="exec")
+            arrow(fi)
+        arrowlevel(-1)
+
     def generate_json_description(self, payloads):
         '''
         Generate a JSON description file