Merged fix for BIL tests from fix_bil_tests branch.