Hey Tom,
You don’t need to take this into account. You can use the maximum workarea, since there is some reserve around the boundaries, which you can also flatten with the larger radius of the flattening bit (see also: → Cutting area location ).
But anyway, your file, which flattens a slightly smaller area than the workarea, is fine and does not produce an error when I try to reproduce your issue. The error must be in your homing and zeroing procedure.