Permition fix in joining paths

The was a bug in joining paths.