Fix damage of ks function