fixed error in query helper which was caused by old searches stored in db