diff --git a/src/pystencils_autodiff/backends/astnodes.py b/src/pystencils_autodiff/backends/astnodes.py
index 35af9bef1c71ab27c88167487a07f03a3c400cb1..814cca75ac1f3985ba8298a2833c9ab2b277ee05 100644
--- a/src/pystencils_autodiff/backends/astnodes.py
+++ b/src/pystencils_autodiff/backends/astnodes.py
@@ -108,7 +108,7 @@ class TorchModule(JinjaCppFile):
                                [file_name],
                                with_cuda=self.is_cuda,
                                extra_cflags=['--std=c++14'],
-                               build_directory=join(cache_dir, 'object_cache'),
+                               build_directory=get_cache_config()['object_cache'],
                                extra_include_paths=[get_pycuda_include_path(),
                                                     get_pystencils_include_path()])
         return torch_extension