improved suport for subdirectories