fix flash implementation