First round of bug fixes from test script.