update to better handle the directory path management