Fix errors occurd when invoking the JSON api backed by Sqlite/MySQL