Fix several bugs connected with displaying search history, choosing database and saving results