fixed a loop (another error that PyLint didn't find)