Fixed a bug in the beta error calculation.