support auto change dir mode