Numerous fixes for the bootloader.