Fixed texture reference in texture class. Now only allocate a texture
once