Bug fixes while getting run_sanity to work