Fixed error: wrong variable used to display warning
flake8 fixes