database fixes, starting to do some tests