You should move this incrementation prior the test. In this case, a flush and clear is executed at the end of the first loop.