fix bugs in bootstrapping