Debugging - boundary problem & the algorithm cannot stop right now