fix bug in bias calculation