Trying to fix directory detection again