added a fix_z0_shape function and used it in matrix conversions using z0