In all cases, serialise Data if not a string

And update tests for check data consistency.

@prune998, can you check this PR with real database ?