Fixed the directory traversal for layer subdirectories