Fixes a bug that would cause the wrong texture to be rendered for an object in some instances.