diff --git a/cpu/cpujit.py b/cpu/cpujit.py
index 5542d0d932381915d7e2961e61702ba6230fc5a6..0578654eaf48129c9864a32805b72e453f6fad09 100644
--- a/cpu/cpujit.py
+++ b/cpu/cpujit.py
@@ -210,8 +210,8 @@ def readConfig():
         createFolder(configPath, True)
         json.dump(config, open(configPath, 'w'), indent=4)
 
-    config['cache']['sharedLibrary'] = os.path.expanduser(config['cache']['sharedLibrary'])
-    config['cache']['objectCache'] = os.path.expanduser(config['cache']['objectCache'])
+    config['cache']['sharedLibrary'] = os.path.expanduser(config['cache']['sharedLibrary']).format(pid=os.getpid())
+    config['cache']['objectCache'] = os.path.expanduser(config['cache']['objectCache']).format(pid=os.getpid())
 
     if config['cache']['clearCacheOnStart']:
         shutil.rmtree(config['cache']['objectCache'], ignore_errors=True)
diff --git a/cpu/kernelcreation.py b/cpu/kernelcreation.py
index dab631a97f19572e6f9275d0f4ffdba0ac68a665..897cbb6a4a0dacc9f7b51809b8e54aca594af14a 100644
--- a/cpu/kernelcreation.py
+++ b/cpu/kernelcreation.py
@@ -139,7 +139,7 @@ def addOpenMP(astNode, schedule="static", numThreads=True):
 
     assert type(astNode) is ast.KernelFunction
     body = astNode.body
-    threadsClause = "" if numThreads else " num_threads(%s)" % (numThreads,)
+    threadsClause = "" if numThreads and isinstance(numThreads,bool) else " num_threads(%s)" % (numThreads,)
     wrapperBlock = ast.PragmaBlock('#pragma omp parallel' + threadsClause, body.takeChildNodes())
     body.append(wrapperBlock)