Fix a bug in loadTexture