fixup models and tests that go with them
redefine logging
fix foreign keys in models