diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 0049c253..4c3579fe 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -2,10 +2,8 @@ name: package test
 
 on:
   pull_request_target:
-    paths:
-      - '*.*'
+    types: [opened, synchronize, reopened]
   push:
-    branches: ['main']
 
 jobs:
   dl_files:
diff --git a/src/mpol/datasets.py b/src/mpol/datasets.py
index 10925a65..db430853 100644
--- a/src/mpol/datasets.py
+++ b/src/mpol/datasets.py
@@ -101,7 +101,7 @@ def add_mask(
             device (torch.device) : the desired device of the dataset. If ``None``, defalts to current device.
         """
 
-        new_2D_mask = torch.tensor(mask, device=device)
+        new_2D_mask = torch.Tensor(mask).detach().to(device)
         new_3D_mask = torch.broadcast_to(new_2D_mask, self.mask.size())
 
         # update mask via an AND operation, meaning we will only keep visibilities that are