use proper function to get file location (thanks to @JacobSanford)