Bootstrap fix and some optimizations