Fixed the handling of the directory validation