change block generator not to held block is they are empty + minor pep8 refacto (pylint:8.85/10)