fixes a bug where deleting a delivery would crash the system