updating weights