fix bug on v5 code