fix charset getting reset to nil unintentionally