Properly dealing with script directory