figuring out the correct directory path