fix window flashing issue by revising innerHTML usage