Attempt to fix crash when refreshing textures
Fixes #12