Fixed bug that caused crash on OS X when loading textures.