Fixed search function