fixed eternal while for elements without correct bounds