fixed a files error on main loops