ToArray method corrected