Fix logic error in triangle, fix typo in square.