fixed a bug with kr xir calculation