better handle dirs