diff --git a/pytools/batchjob.py b/pytools/batchjob.py
index fa5ca65f3d64c0666386dc07d3ab10cde0520dde..d681f02d8ea1b085ce7fdbd50ab9a66c66503ef5 100644
--- a/pytools/batchjob.py
+++ b/pytools/batchjob.py
@@ -51,9 +51,10 @@ class BatchJob(object):
                 % (sys.executable, main_file))
         runscript.close()
 
-        _cp(main_file, os.path.join(self.path, main_file))
+        from os.path import basename
+        _cp(main_file, os.path.join(self.path, basename(main_file)))
         for aux_file in aux_files:
-            _cp(aux_file, os.path.join(self.path, aux_file))
+            _cp(aux_file, os.path.join(self.path, basename(aux_file)))
 
     def write_setup(self, lines):
         import os.path
@@ -132,6 +133,8 @@ def guess_job_class():
         return PBSJob
 
 
+
+
 class ConstructorPlaceholder:
     def __init__(self, classname, *args, **kwargs):
         self.classname = classname