Fix a wrong condition for switching SQL & NoSQL in history.get().