added variable for counting the number of messages which could not delivered