Fixed a few small bugs
fixed a few bugs in z and edi and migrating mtplot to deal with new z and edi