Fix bugs in bootstrap