fix some bug and warning