Multiple GL_TEXTURE_2D_ARRAY generations

I’m trying to create multiple texture 2D arrays for texturing a heightmap along with a bumpmap for the textures.

The problem is when I load multiple arrays it overwrites the first array’s texture data.

TextureArray::TextureArray(const char* directory, int number)
{
initBuffers();

int width = 0;
int height = 0;

for(int i = 0; i < number; i++)
{
    char buffer[256];
    sprintf(buffer, "%s%i.png", directory, i);

    if(!this->LoadFile(buffer, number, i, &width, &height))
    {
        Destroy();
        return;
    }
}

}

void TextureArray::initBuffers()
{
glGenTextures(1, &textures);
glBindTexture(GL_TEXTURE_3D, textures);

glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_REPEAT);

}

void TextureArray::Destroy()
{
glDeleteTextures(1, &textures);
}

bool TextureArray::LoadFile(char* file, int size, int index, int* width, int* height)
{
Texture* texture = LoadTextureFromFile(file, false);

if(texture == NULL)
{
    return false;
}

unsigned char* data = texture->data;

if(data)
{
    if(index == 0)
    {
        *width = texture->width;
        *height = texture->height;

        glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, texture->bitDepth == ImageType::RGBA ? GL_RGBA : GL_RGB, *width, *height, size, 0, texture->bitDepth == ImageType::RGBA ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE, NULL);
        checkError("I==0");
    }

    if(texture->width != *width || texture->height != *height)
    {
        return false;
    }

    glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, index, texture->width,  texture->height, 1, texture->bitDepth == ImageType::RGBA ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE, data);
    checkError(file);

    free(data);
}

free(texture);

return true;

}

textureArray = new TextureArray(“textures/”, TEXTURE_ARRAY_SIZE);
bumpMapArray = new TextureArray(“bumpmaps/”, TEXTURE_ARRAY_SIZE);

bumpMapArray overwrites the data in the textureArray.