diff --git a/qutil/matlab.py b/qutil/matlab.py
index 7999e3c5ede1f9fdc3a665c35aef33cd33d18c69..cab5dc432d3f913b763f7e94e02c4bc9c0fbb9c9 100644
--- a/qutil/matlab.py
+++ b/qutil/matlab.py
@@ -1,7 +1,7 @@
 """This module contains utility functions that help interacting with matlab and matlab files"""
 import itertools
-import pathlib
 import warnings
+import os
 from typing import Tuple, Sequence
 
 import numpy
@@ -18,7 +18,8 @@ except ImportError:
                   "Navigate to 'C:\Program Files\MATLAB\R2020b\extern\engines\python' and call 'python setup.py install'")
     matlab = None
 
-__all_ = ['load_special_measure_scan', 'cached_load_mat_file', 'special_measure_to_dataframe']
+__all_ = ['load_special_measure_scan', 'cached_load_mat_file', 'special_measure_to_dataframe',
+          'load_special_measure_with_matlab_engine']
 
 
 class ModuleEngineWrapper:
@@ -43,10 +44,11 @@ def read_table(engine, path: str) -> pandas.DataFrame:
                             columns=col_names, index=row_names)
 
 
-def load_special_measure_with_matlab_engine(file_name: str, engine=ModuleEngineWrapper) -> Tuple[pandas.DataFrame,
-                                                                                  Sequence[numpy.ndarray],
-                                                                                  pandas.Series,
-                                                                                  Sequence[Sequence[str]]]:
+def load_special_measure_with_matlab_engine(file_name: os.PathLike,
+                                            engine=ModuleEngineWrapper) -> Tuple[pandas.DataFrame,
+                                                                                 Sequence[numpy.ndarray],
+                                                                                 pandas.Series,
+                                                                                 Sequence[Sequence[str]]]:
     """
     Load special measure scan using MATLAB. This requires that the package delivered with MATLAB is installed.
 
@@ -84,7 +86,7 @@ def load_special_measure_with_matlab_engine(file_name: str, engine=ModuleEngineW
             return chan
     
     # we cannot return a struct array to python so we load it into the namespace
-    engine.load(file_name, 'scan', 'data', 'configch', 'configvals', nargout=0)
+    engine.load(os.fspath(file_name), 'scan', 'data', 'configch', 'configvals', nargout=0)
     
     data = engine.workspace['data']
     configch = engine.workspace['configch']
@@ -218,7 +220,6 @@ def special_measure_to_dataframe(loaded_scan_data: dict,
     data = loaded_scan_data['data']
     assert data.shape == (1, len(measured))
     data = data[0, :]
-    
 
     result = pandas.DataFrame(index=idx)
     assert len(measured) == len(data)
@@ -241,18 +242,15 @@ def special_measure_to_dataframe(loaded_scan_data: dict,
     return result
 
 
-def load_special_measure_scan(file_name: str,
+def load_special_measure_scan(file_name: os.PathLike,
                               squeeze_constant_setchan: bool = True) -> pandas.DataFrame:
     """
-
     :param file_name: Path of the file to load
     :param squeeze_constant_setchan: If true, "set channels" that are constant are not included in the index
-    :param use_cache:
     :return: Data frame with a multi-index that corresponds to the "set channels" and columns that correspond to the
     "get channels".
     """
-    if isinstance(file_name, pathlib.Path):
-        file_name = str(file_name)
+    file_name = os.fspath(file_name)
     
     # this is slow as the scan stuct is quite complicated and hdf5storage creates a dtype for the whole thing
     file_contents = hdf5storage.loadmat(file_name)
@@ -260,7 +258,6 @@ def load_special_measure_scan(file_name: str,
     return special_measure_to_dataframe(file_contents, squeeze_constant_setchan)
 
 
-
 @qutil.caching.file_cache
 def cached_load_mat_file(filename):
     return hdf5storage.loadmat(filename)