ktbs: fixed a few bugs