Fix downloader sorting bug

This fixes a bug in sorting of feeds which was causing a crash in the downloader.
a few pep 8 fixes where added as well.