Ack_msg function modified to fix errors