Fixed undefined names from pyflakes