fix code follow flow