fix files function bug