Fix bug with empty array.