Flash algorithm fixes.