fix the base dir function's bug