Fix crash bug when updating messages