Included debugging code to detect bad messages