Completed and tested bootloader to recover from invalid firmware