check if messages are valid before trying to deliver them