added more test cases for pivot elemtn
Fixed a bug in the impl of pivot(x, y)