fix insertion for subdirs