Why need 'flag == true'?