Fixing bugs in KS