fixes bug in filesystem function where original path is not preserved