Fix a bug in the #UDGARRAY macro

This bug prevents a mask from being applied to a UDG array when at
least one UDG in the array has no mask defined.
Fix some bugs in the creation of cropped images