fix for another inifinite loop condition