fix some bug from feedback of mr.Cuong