attempt to solve infinite loop