fixed some bugs caused by the triangles
Merge branch 'master' into gh-pages