fix a few bugs in setup_base