Fixed bug in updating associations