Bug fixes to match expected output.