Fix collectArray method