Bug 2 inserted

Bug is related to the entry condition for second loop. It ends up
ignoring the first iteration of the outer loop.