fixed pyflakes on py2

fixes issues on Python 2 with #2776