Fix for #4: call toPath on file, not function