Fix directory name sanitization bug