diff --git a/sources/user_problem.F90 b/sources/user_problem.F90
index 4f0b935..4e37763 100644
--- a/sources/user_problem.F90
+++ b/sources/user_problem.F90
@@ -437,9 +437,12 @@ module user_problem
 
     close(runit)
 
-    deallocate(kx, ky, kz, ux, uy, uz, ph, stat = status)
-    call print_message(loc, &
+    if (pert == 2) then
+      deallocate(kx, ky, kz, ux, uy, uz, ph, stat = status)
+      if (status /= 0) &
+        call print_message(loc, &
                          "Could not deallocate space for perturbation vectors!")
+    end if
 
 !-------------------------------------------------------------------------------
 !