When I debugged it after removing comments , I got like this in the command window:

DEBUG2: m = 3 i = 0
{f} = 2 {u} 2
DEBUG2: m = 2 i = 0

The bug is exactly here at the end of the CheckPoss function, because the value of 'm' should not decrease .