some defensive coding to support multi threaded texture loading.