Fix bug with search function in Engine class