fix possible IndexError
file operations now functioning