Fix a small bug in calc_x_3s. 

I'm not completely sure whether it's really a bug, or if I'm just doing something wrong.
You might want to investigate that before you decide to apply the change.