correction of square func