get the right beta cause outside the loop