I'd be surprised if G54 is Mach's default coordinate system, it might be the default workshift, but the real coordinate system that belongs to the machine (and where G28 references) is G53.
That call for G28 X0 Y0 A0 at the tool change bothers me a bit. That is a command to move to machine zero through points X0 and Y0. Since G91 was not commanded on that line, it may have attempted to move through the current workshift's X0Y0. Without being there and experimenting with the machine, its tough to guess what the control would try to do.
So perhaps try
G00 G91 G28 X0 Y0
as the 'fully written out' command.
Also as a safety, after a tool change it is a good habit to insert a safety line like this:
/G0 G54 X0 Y0
This sends the tool to the workshift X0Y0 where you can do a visual check that indeed the tool is at the datum. Once you get into running the program repeatedly, you can then skip this move with the block delete switch.
First you get good, then you get fast. Then grouchiness sets in.
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)