Added expected output to harden tests, fixed the critical bug it exposed.