fixed depdency and flashing logic