fix Compare and swap returns incorrect cause

fix for issue #611

Note that compare-and-delete cause changed too.
I worry about modifications in v1 tests while v1 API is frozen.

Thank you!