Fix base_dir undefined error