break for loop when possible