fixed a couple bugs in texture and layer