diff --git a/src/files.jl b/src/files.jl
index 5b50b68a2c36f9a1b614a442437e00e507794363..8896e04c8ba71604234d19e5c01a14db6fc430c7 100644
--- a/src/files.jl
+++ b/src/files.jl
@@ -270,9 +270,9 @@ function savetofile(controller, file; datafile=nothing)
                 datafile = gethub(controller)[:input][]
             end
         end
-        datafilepath = isfile(datafile) ? datafile : joinpath(cwd(controller), datafile)
-        deps = getdependencies(getinputfile(controller)[])
+        deps = getdependencies(gethub(controller)[:input][])
         if isempty(deps)
+            datafilepath = isfile(datafile) ? datafile : joinpath(cwd(controller), datafile)
             Datasets.pushdependency!(dataset, datafilepath)
         else
             for dep in deps