fixed some bugs caused by the triangles