fix bug in dir process