Correct bugs with caching searches + handle popstate