fixed bug in array mask handling