fixed SCRIPT_NAME handling