Fix issue with relative commands after Z.

Closes #413.