I think that you have to do the same thing with blocks prior to filling it
blocks
blocks=new PImage[....