diff --git a/setup.py b/setup.py
index 0599db0b32448f541400907ac379c39057bed146..5840793e5d70c346cfb7230cd267bfa3b7e86e54 100644
--- a/setup.py
+++ b/setup.py
@@ -18,7 +18,6 @@ vf_cmake_args = [
     "-DCMAKE_CXX_COMPILER_LAUNCHER=ccache",
     "-DCMAKE_CUDA_COMPILER_LAUNCHER=ccache",
     "-DCMAKE_C_COMPILER_LAUNCHER=ccache",
-    "-DUSE_MPI=ON",
     "-DBUILD_SHARED_LIBS=OFF",
     "-DBUILD_WARNINGS_AS_ERRORS=OFF"
 ]
@@ -28,13 +27,13 @@ vf_cpu_cmake_args = [
     "-DBUILD_VF_CPU:BOOL=ON",
     "-DBUILD_VF_UNIT_TESTS:BOOL=ON",
     "-DUSE_METIS=ON",
+    "-DUSE_MPI=ON"
 ]
 
 vf_gpu_cmake_args = [
     "-DBUILD_VF_DOUBLE_ACCURACY=OFF",
     "-DBUILD_VF_GPU:BOOL=ON",
     "-DBUILD_VF_UNIT_TESTS:BOOL=OFF",
-    "-DUSE_METIS=OFF",
 ]
 
 
@@ -47,14 +46,6 @@ class CommandMixin:
         super().initialize_options()
         self.GPU = False
 
-    def finalize_options(self):
-        super().finalize_options()
-
-    def run(self):
-        global GPU
-        GPU = self.GPU
-        super().run()
-
 class InstallCommand(CommandMixin, install):
     user_options = getattr(install, 'user_options', []) + CommandMixin.user_options
 
@@ -108,13 +99,16 @@ class CMakeBuild(CommandMixin, build_ext):
             build_args += ['--', '-j2']
 
         cmake_args.extend(vf_cmake_args)
-        cmake_args.extend(vf_gpu_cmake_args if GPU else vf_cpu_cmake_args)
+        cmake_args.extend(vf_gpu_cmake_args if self.GPU else vf_cpu_cmake_args)
 
         env = os.environ.copy()
         env['CXXFLAGS'] = '{} -DVERSION_INFO=\\"{}\\"'.format(env.get('CXXFLAGS', ''),
                                                               self.distribution.get_version())
         if not os.path.exists(self.build_temp):
             os.makedirs(self.build_temp)
+        cmake_cache_file = self.build_temp+"/CMakeCache.txt"
+        if os.path.exists(cmake_cache_file):
+            os.remove(cmake_cache_file)
         subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env)
         subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp)