fix another occurrence of dirname

The directory name evaluation has an issue if the script is called from the same directory, then PROGRAM_DIR is set to $0.