kb_hit function