Fix crash caused by a change in API response for patches
Also fixes a bug that caused some patches to be ignored (patch file number was not reset after while loop that increased it)