fixes bug in texture upload