diff --git a/lofar-cwl/steps/gaincal.cwl b/lofar-cwl/steps/gaincal.cwl
index 894068f51c465d3620cb64c1a7d527aeee70eae1..843045b50b86eadc653da5053f866244ae43534c 100644
--- a/lofar-cwl/steps/gaincal.cwl
+++ b/lofar-cwl/steps/gaincal.cwl
@@ -8,7 +8,7 @@ baseCommand:
   - DPPP
 inputs:
   - id: msin
-    type: Directory?
+    type: Directory
     inputBinding:
       position: 0
       prefix: msin=
@@ -110,7 +110,7 @@ outputs:
     doc: Output Measurement Set
     type: Directory
     outputBinding:
-      glob: '$(inputs.msout_name=="."?inputs.msin:inputs.msout_name)'
+      glob: '$(inputs.msout_name=="."?inputs.msin.basename:inputs.msout_name)'
   - id: h5parm
     doc: Filename of output H5Parm (to be read by e.g. losoto)
     type: File
@@ -129,6 +129,10 @@ hints:
   - class: DockerRequirement
     dockerPull: 'lofareosc/prefactor:HBAcalibrator'
 requirements:
+  - class: InitialWorkDirRequirement
+    listing:
+      - entry: $(inputs.msin)
+        writable: true
   - class: InlineJavascriptRequirement
 $schema:
   - 'https://git.astron.nl/eosc/ontologies/raw/master/schema/lofar.owl'
diff --git a/subworkflow/calib_targ.cwl b/subworkflow/calib_targ.cwl
index 953822e585264f680093fe8fb753b2dedb5b3efd..706c5ab7b5f3432bbd4c4ee732adce38e2aebeb5 100644
--- a/subworkflow/calib_targ.cwl
+++ b/subworkflow/calib_targ.cwl
@@ -71,6 +71,8 @@ steps:
         source: BLsmooth/msout
       - id: msin_datacolumn
         default: SMOOTHED_DATA
+      - id: msout_name
+        default: '.'
       - id: sourcedb
         source: skymodel
       - id: parmdb