fix bug and warning