Corrected error if replicate array is empty.