Fix search break logic and index HTML properly