max was wrong in the definition of beta. it should be min