Bugfixes in the search function