Fixed some bugs for the tests, and also estimate fill ratio bugs