added protection against bad messages