Fix bug with directories
TODO