Fixed error with empty array.