fixed a bug with scaling and expected counts