fix issues 487 and a bug in pyflakes