Fixed getFilename to pattern match.