fix getting first element in array