add some check

check if the board has been programmed before.
change the way of hang after error encountered