Use null-safe equals in autorefill.
Make autorefill sync after completion.
Do inventory syncs after some other points where items are moved.