adde some test for associations and some methods also fixed generation of key