backout kx.c changes made for #221