fix loop exception