finally fixed the worst flashing bugs