fixed $base_dir variable

The variable had different names throughout the code snippet