Fixed the error, the iP++ was moving the -1 flag value back to 0 so the loop always continued