fix bugs add dir support