correct minor bug in r_square