Some modifications in inventory save routine.