Fix bug with extending arrays