Fixed bugs found in associated entity updates. Added more tests, more tests to come.