Fixes to test case 5 through 8