Bug fix for multiple file handling