fixing errors in train_agent_weights