Fixed SQL code in doDelete.
Fixed merge errors.
Writing maps with JSONWriter leads to out of order keys for tests.