Fixing (possibly?) memory leak of path object