Added some checks to execute scripts and ack messages