Correct the calculation of the script directory