Smoke test script plus miscellaneous bug fixes