Fix some errors in triangle rendering