prevent infinite looping