fix all the broken code

target is to pass all the tests first, especially for creating relations