Fixed issues with textures larger than 16x16