Database test

-Continuation of fixes to databases
-Minor improvements to checkWellFormed