fixed some bugs found during training trials