added sanity checks to firmware upgrade