replace all endless for loops by while
Merge pull request #704 from mehlis/for-while

replace all endless for loops by while