fix bug in matrix-to-squares & add comments in tests