I think you may have mistaken beta and gamma with the running mean and running variance.
The correct bn operation should be:
x_hat = [(x-running_mean)/running_var]*gamma + beta
So the beta and gamma are actually the bias and weight in bn layer.