Correct variable in get_filenames method.

Removed static keyword. When using this function multiple times, the variable collects filenames from the previous iterations.