Fix bugs in delivery atx function