"dirname: missing operand" issue when starting SITL

I’m having a issues trying to get a setup SITL on ubuntu 15.10. I am following this wiki (dev.ardupilot.com/wiki/setting-up-sitl-on-linux/). However, when I got everything ready and try to start SITL, I got an error message “dirname: missing operand”. I attached the full terminal output below. Could anyone help me on this please ?

./sim_vehicle.sh -w
dirname: missing operand
Try ‘dirname --help’ for more information.
./sim_vehicle.sh: line 323: pushd: no other directory
Failed to change to vehicle directory for
Usage: sim_vehicle.sh [options] [mavproxy_options]
Options:
-v VEHICLE vehicle type (ArduPlane, ArduCopter or APMrover2)
vehicle type defaults to working directory
-I INSTANCE instance of simulator (default 0)
-V enable valgrind for memory access checking (very slow!)
-G use gdb for debugging ardupilot
-g use gdb for debugging ardupilot, but don’t auto-start
-D build with debugging
-B add a breakpoint at given location in debugger
-T start an antenna tracker instance
-A pass arguments to SITL instance
-t set antenna tracker start location
-L select start location from Tools/autotest/locations.txt
-l set the custom start location from -L
-c do a make clean before building
-N don’t rebuild before starting ardupilot
-w wipe EEPROM and reload parameters
-R reverse throttle in plane
-M enable MAVLink gimbal
-f FRAME set aircraft frame type
for copters can choose +, X, quad or octa
for planes can choose elevon or vtail
-b BUILD_TARGET override SITL build target
-j NUM_PROC number of processors to use during build (default 1)
-H start HIL
-S SPEEDUP set simulation speedup (1 for wall clock time)
-d TIME delays the start of mavproxy by the number of seconds

mavproxy_options:
–map start with a map
–console start with a status console
–out DEST start MAVLink output to DEST

Note:
eeprom.bin in the starting directory contains the parameters for your
simulated vehicle. Always start from the same directory. It is recommended that
you start in the main vehicle directory for the vehicle you are simulating,
for example, start in the ArduPlane directory to simulate ArduPlane

Fine. This problem is caused by the following lines of code.

pushd $VEHICLEDIR || { echo "Failed to change to vehicle directory for $VEHICLEDIR" usage exit 1 }

Somehow, it could be solved by manually creating a folder matching $VEHICLEDIR. Really weird issue.