fix setup command, add extra error check