Fixed an issue with getTextureReference not returning a proper pointer.