change loop flag to false