search and history bugfixes